<%@page import="Bean.BMenu"%>
<%@page import="Bean.BSupMenu"%>
<%@page import="Bean.BSubMenu"%>
<%@page import="Bean.BArticle"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
    <head>
		
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
        <title>Mapor - Cổng thông tin tuyển sinh</title>  
        <link rel="shortcut icon" href="img/Logo.png" type="image">
        <link rel="stylesheet" type="text/css" href="css/style.css" />
        <link rel="stylesheet" type="text/css" href="css/index.css" />			
        <link rel="stylesheet" type="text/css" href="css/login.css" />
	<link rel="stylesheet" type="text/css" href="css/slide.css" />
	<link rel="stylesheet" type="text/css" href="css/menu.css" />
	<link rel="stylesheet" type="text/css" href="css/container.css" />
    </head>
    <body>
		<div id="wrap">			
			<div id="left">
				<%				
				
				List<BMenu> Menus = null;
				List<BArticle> articles = null;
				
				if(request.getAttribute("Menus") != null&&request.getAttribute("newArticle") != null){
					Menus = (List<BMenu>) request.getAttribute("Menus");
					articles = (List<BArticle>) request.getAttribute("newArticle");
				}else{
					response.sendRedirect("CIndex.do?act=viewIndex");
                                }				
				
				if((Menus != null)&&(articles != null)) {%>	
					<div id="nav" >
					<ul id="sub-menu">
					<% for (int i=0 ;i<Menus.size();i++) {
                        if(Menus.get(i).getState()) { %>
                            <li class="li<%=i%> active" id="n<%=Menus.get(i).getIDSupMenu()%>">
							<a  href="#n<%=Menus.get(i).getIDSupMenu()%>"><%=Menus.get(i).getNameSupMenu().toUpperCase() %></a>
					<% } else {%>
                            <li class="li<%=i%>" id="n<%=Menus.get(i).getIDSupMenu()%>">
							<a href="#n<%=Menus.get(i).getIDSupMenu()%>"><%=Menus.get(i).getNameSupMenu().toUpperCase() %></a>
					<%}%>
					<ul class="sub-menu">
                    <%for(int j=0; j< Menus.get(i).getSubMenus().size();j++){%>                        
							<%if(Menus.get(i).getSubMenus().get(j).getState()){ %>			
								<li><a href="#<%= Menus.get(i).getSubMenus().get(j).getIDSubMenu()%>"> <p><%=Menus.get(i).getSubMenus().get(j).getNameSubMenu() %></p></a></li>
							<% } else {%>
								<li><a href="#n<%=Menus.get(i).getSubMenus().get(j).getIDSubMenu()%>"> <p><%=Menus.get(i).getSubMenus().get(j).getNameSubMenu() %></p></a></li>
							<%}%> 
					<%}%>							
					</ul>
					</li>
					<%}%>
				</ul>
			</div>
			<%}%>
			</div>
			<div id="right">
				<div id="from-Login">
					<div id="login-header">
                                            <div id="lblTenDN">
                                                <p name="TenDN"><%if(request.getAttribute("TenDN") !=null){ %>Xin chào,&nbsp;<b><%= request.getAttribute("TenDN") %></b><% } %></p>
                                            </div>
						<div id="login-link">
						<a class="login-link login" href="#login" title="Login">Đăng nhập </a>	
						<span>|<span>
						<a class="login" href="#Signup" title="Login">Đăng ký</a>
						</div>
						<div id="login-panel">
                                                    <form action="CIndex.do" method="get">
                                                            <p>
                                                            <label class="label">Tài khoản:
                                                            <input name="username" type="text" value="" />
                                                            </label> <br />
                                                            <label class="label">Mật khẩu:
                                                            <input name="password" type="password" value="" />
                                                            </label><br /><br />
                                                            <label class="label">
                                                            <input name="remeber" type="checkbox" value="" />
                                                            Nhớ mật khẩu
                                                            </label><br /><br/>
                                                            <input id="submit"type="submit" name="submit" value="Đăng nhập" />					
                                                            </p>
                                                    <% 
                                                        //String kt="";request.getAttribute("KTDNhap").toString();
                                                        if(request.getAttribute("KTDNhap")!=null)
                                                        {
                                                            out.print("<script>  alert('" +request.getAttribute("KTDNhap").toString()+ "'); </script>");
                                                        }
                                                    %>
                                                    </form>
						</div>
					</div>
				</div>					
				<%if(articles!=null) {%>
					<div id="da-slider" class="da-slider">
						<%for(int i=0; i< articles.size();i++) {%>
							<div class="da-slide">
								<h2><%=articles.get(i).getTieuDe() %></h2>
								<p><%=articles.get(i).getGioiThieuBaiViet() %></p>
								<div class="da-img"><img src="<%=articles.get(i).getHinhAnhDD() %>" alt="image<%=i%>" /></div>
								<a href="#" class="da-link">ĐỌC TIẾP</a>
							</div>
						<%}%>						
						<nav class="da-arrows">
							<span class="da-arrows-prev"></span>
							<span class="da-arrows-next"></span>
						</nav>
					</div>
				<%}%>
				
				<% for (int i=0 ;i<Menus.size();i++) {%>
                                <div id="<%=i%>" class="container">
                        <input id="select-<%=i%>all" name="<%=Menus.get(i).getIDSupMenu()%>" type="radio" class="select-<%=i%>all"  />
						<label for="select-<%=i%>all" class="label-<%=i%>all"><%=Menus.get(i).getNameSupMenu().toUpperCase() %></label>                            
                    <%for(int j=0; j< Menus.get(i).getSubMenus().size();j++){%> 
						<input id="select-<%=Menus.get(i).getSubMenus().get(j).getIDAlias()%>" name="<%=Menus.get(i).getIDSupMenu()%>" type="radio" class="select-<%=Menus.get(i).getSubMenus().get(j).getIDAlias()%>" />
						<label for="select-<%=Menus.get(i).getSubMenus().get(j).getIDAlias()%>" class="label-<%=Menus.get(i).getSubMenus().get(j).getIDAlias()%>"><%=Menus.get(i).getSubMenus().get(j).getNameSubMenu() %></label>
						<%}%>
				<div class="clr"></div>
				<ul id="items">
				<%for(int k=0;k<articles.size();k++){
					String alias = Menus.get(i).getIDSubMenu(articles.get(k).getTag());
					if(alias!=null){
				%>				
					<li class="item-<%=alias%> items">
						<a href="#">
							<span><%=articles.get(k).getGioiThieuBaiViet() %></span>
							<img src="img/1.jpg" />
							<p><%=articles.get(k).getTieuDe() %></p>
						</a>
					</li>
					<%}}%>					
				</ul>
                                <%}%>
                </div>
				
							
			</div>
			<script type="text/javascript" src="js/jquery.min.js"></script>
			<script type="text/javascript" src="js/modernizr.custom.28468.js"></script>		
			<script type="text/javascript" src="js/jquery.cslider.js"></script>	
			
			<script type="text/javascript">
			$(document).ready(function(){
				$("#login-link").click(function(){
					$("#login-panel").slideToggle(200);
				})
			})
			$(document).keydown(function(e) {
				if (e.keyCode == 27) {
					$("#login-panel").hide(0);
				}
			});
			</script>
			
			<script type="text/javascript">
					$(function() {
							$('#da-slider').cslider({
									autoplay	: true,
									bgincrement	: 450
							});
					});
			</script>		
		</div>
    </body>
</html>